package com.wn.ticket.service.impl;

import com.wn.ticket.entity.User;
import com.wn.ticket.mapper.UserArtistMapper;
import com.wn.ticket.mapper.UserPerformMapper;
import com.wn.ticket.service.UserArtistService;
import com.wn.ticket.service.UserPerformService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 收藏Service实现
 *
 * @author 杜昭进
 * date: 2022/8/29
 */
@Slf4j
@Service
public class UserPerformServiceImpl implements UserPerformService {

    @Autowired
    private UserPerformMapper userPerformMapper;


    /**
     * 收藏 增加
     *
     * @param userId
     * @param performId
     */
    @Override
    public void add(int userId, int performId) {
        userPerformMapper.userPerformInsert(userId, performId);
    }

    /**
     * 收藏 删除
     *
     * @param userId
     * @param performId
     */
    @Override
    public void deleted(int userId, int performId) {
        userPerformMapper.userPerformDeleted(userId, performId);
    }

    /**
     * 根据用户id查询所有收藏的演出
     *
     * @return user
     */
    @Override
    public User getAllByUserId(int userId) {
        User users = userPerformMapper.getByUserId(userId);
        return users;
    }
}